<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <base href="./">
    <link href="libs/layui/css/layui.css" rel="stylesheet">
    <script type="text/javascript" src="libs/jquery/jquery-1.11.1.js"></script>
    <script type="text/javascript" src="libs/layui/layui.all.js"></script>
    <script type="text/javascript" src="libs/js/util.js"></script>
    <script type="text/javascript" src="libs/js/mylayer.js"></script>
    <link href="css/css.css" rel="stylesheet">
    <style type="text/css">
        .layui-table {
            margin-left: 30px !important;
        }
        .searchinput {
        	width: 200px;height: 25px;
        }
    </style>
</head>
<body>
<div class="demoTable">
    <script type="text/javascript">
        function toClient(id) {
        	location.href='Client?checkin_id='+id;
        }
    </script>
    <form action="CheckIn" method="post">
        <select name="txt" class="searchinput">
			<c:forEach items="${statuss }" var="r" varStatus="v">
				<c:if test="${txt!=v.index}">
                    <option value="${v.index}">${r}</option>
                </c:if>
                <c:if test="${txt==v.index}">
                    <option value="${v.index}" selected="selected">${r}</option>
                </c:if>
			</c:forEach>
        </select>
        <button type="submit" class="layui-btn">查询</button>
        <button class="layui-btn" type="button" onclick="location.href='CheckIn?cmd=add'">新增</button>
    </form>
</div>

<div class="layui-form layui-border-box layui-table-view">
    <div class="layui-table-box">
        <div class="layui-table-body layui-table-main">
            <table class="layui-table">
                <thead>
                <tr>
                    <td style="width: 100px;">入住时间</td>
                    <td style="width: 100px;">操作员</td>
                    <td style="width: 100px;">房间名</td>
                    <c:if test="${txt==0 }">
                    	<td style="width: 100px;">预计时间</td>
                    </c:if>
                    <c:if test="${txt==1 }">
                    	<td style="width: 100px;">离开时间</td>
                    </c:if>
                    <td style="width: 100px;">应缴金额</td>
                    <td style="width: 100px;">押金</td>
                    <td style="width: 100px;">备注</td>
                    <td width="200px;">操作</td>
                </tr>
                </thead>
                <tbody>

                <c:forEach items="${list}" var="row" varStatus="v">
                    <tr>
                        <td>${row.date}</td>
                        <td>${row.user_name}</td>
                        <td>${row.room_name}</td>
                        <c:if test="${txt==0 }">
                        	<td>${row.exitdate}</td>
                        </c:if>
                        <c:if test="${txt==1 }">
                        	<td>${row.outdate}</td>
                        </c:if>
                        <td>${row.amount}</td>
                        <td>${row.yamount}</td>
                        <td>${row.comments}</td>
                        <td>
                            <a href="javascript:;" onclick="toClient(${row.id});">入住人</a>
                            <c:if test="${txt==0 }">
                            	<a href="CheckIn?cmd=pay&id=${row.id}">结账</a>
                            	<a href="CheckIn?cmd=cancel&id=${row.id}">作废</a>
                            </c:if>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </div>
    </div>
</div>
</body>
</html>